/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.svh.Entidad;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 *
 * @author David
 */
@Entity
@Table(name = "cliente_juridico")
public class Cliente_Juridico implements Serializable {
    
    @GenericGenerator(name = "generator", strategy = "foreign",
            parameters = @Parameter(name = "property", value = "padre"))
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "idCliente", unique = true, nullable = false)
    Integer id;
    
    @OneToOne(fetch = FetchType.LAZY)
    @PrimaryKeyJoinColumn
    Cliente padre;
    
    @Column(name = "razon_social")
    private String razonSocial;

    public Cliente_Juridico() {
        super();
    }

    @Override
    public String toString() {
        return "Cliente_Juridico{" + "razonSocial=" + razonSocial + '}';
    }
    
    
    
    /** GETTERS AND SETTERS **/
    
    public String getRazonSocial() {
        return razonSocial;
    }

    public void setRazonSocial(String razonSocial) {
        this.razonSocial = razonSocial;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Cliente getPadre() {
        return padre;
    }

    public void setPadre(Cliente padre) {
        this.padre = padre;
    }
    
    
    
}
